import 'package:flutter/material.dart';

class MyApp19 extends StatelessWidget {
  const MyApp19({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('GridView的builder函数使用'),
        backgroundColor: Colors.red,
      ),
      body: GridView.builder(
        // gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
        //   crossAxisCount: 3,
        //   mainAxisSpacing: 10,
        //   crossAxisSpacing: 10,
        //   childAspectRatio: 1,
        // ),
        gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
          maxCrossAxisExtent: 100,
          mainAxisSpacing: 10,
          crossAxisSpacing: 10,
          childAspectRatio: 1,
        ),
        itemBuilder: (BuildContext context, int index) {
          return Container(
            color: const Color.fromARGB(255, 237, 180, 199),
            child: const Text('我的方块'),
          );
        },
        itemCount: 30,
      ),
    );
  }
}
